package com.ysd.lis.controller;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.request.PubTaskPageAddParam;
import com.ysd.lis.service.PubTaskPageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 样品可配置项分类表 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2023-11-13
 */
@Api(tags = "任务消息接口")
@RestController
@RequestMapping("/api/task/page")
public class PubTaskPageController extends BaseController {

    @Autowired
    private PubTaskPageService pubTaskPageService;

    @ApiOperation("获取模板树")
    @GetMapping("/getTaskPageListTree")
    public Result getTaskPageListTree() {
        return pubTaskPageService.getTaskPageListTree();
    }

    @ApiOperation("添加模版树")
    @PostMapping("/addTaskPage")
    @LogDetail(requestParam ="addTaskPage",operationType = OperationType.INSERT, module = "模版树管理",content = "通过模版列表树，增加【name】树节点", businessName = "name")
    public Result addTaskPage(@RequestBody PubTaskPageAddParam pubTaskPageAddParam){
        return pubTaskPageService.addTaskPage(pubTaskPageAddParam);
    }

    @ApiOperation("编辑模版树")
    @PostMapping("/editTaskPage")
    @LogDetail(requestParam ="editTaskPage",operationType = OperationType.UPDATE, module = "模版树管理",content = "通过模版列表树，编辑【name】树节点", businessName = "name")
    public Result editTaskPage(@RequestBody PubTaskPageAddParam pubTaskPageAddParam){
        return pubTaskPageService.editTaskPage(pubTaskPageAddParam);
    }

    @ApiOperation("删除模版树")
    @PostMapping("/deleteTaskPage")
    @LogDetail(requestParam ="deleteTaskPage",operationType = OperationType.DELETE, module = "模版树管理",content = "模版树模块，删除【name】数据", businessName = "name")
    public Result deleteTaskPage(@RequestBody PubTaskPageAddParam pubTaskPageAddParam){
        return pubTaskPageService.deleteTaskPage(pubTaskPageAddParam.getId());
    }
}
